package org.syh.boyangfighthealthclub.dao;

import org.syh.boyangfighthealthclub.entity.User;

import java.sql.Connection;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author: Ben
 * @Date: 2021/2/28 22:49
 * 用户IUserDao
 */
public interface IUserDao {

    /**
     * 用户注册
     * @param connection
     * @param user
     * @return boolean
     */
    boolean insertUser(Connection connection, User user);

    /**
     * 根据id删除用户
     * @param connection
     * @param id
     * @return boolean
     */
    boolean deleteUser(Connection connection,int id);

    /**
     * 根据id更改用户
     * @param connection
     * @param user
     * @return boolean
     */
    boolean updateUser(Connection connection,User user);

    /**
     * 分页查询所有用户
     * @param connection
     * @param pageNumber
     * @param pageSize
     * @return List<User>
     */
    List<User> selectUsers(Connection connection,int pageNumber,int pageSize);

    /**
     * 根据昵称查询用户
     * @param connection
     * @param nickName
     * @return User
     */
    User selectUserByNickName(Connection connection,String nickName);

    /**
     * 查询用户总数
     * @param connection
     * @return int
     */
    int selectCountUsers(Connection connection);


    /**
     * 根据id查询用户信息
     * @param connection
     * @param id
     * @return User
     */
    User selectUserById(Connection connection,Integer id);
}
